<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/masterPage.master" CodeBehind="Company.aspx.cs" Inherits="www.Company" %>

<%@ Register Assembly="NBusiness" Namespace="NBusiness.Data.Web" TagPrefix="cc1" %>

<asp:Content ID="Content1" runat="Server" ContentPlaceHolderID="contentPlaceHolder1">
    <asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="CompanyDataSource"
        Height="50px" Width="125px" AutoGenerateRows="False" DataKeyNames="CompanyId" OnDataBound="DetailsView1_DataBound">
        <Fields> 
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
            <asp:TemplateField HeaderText="Addresses">
                <ItemTemplate>
                    <asp:GridView ID="GridView2" runat="server" DataSourceID="AddressDataSource" AutoGenerateColumns="False" DataKeyNames="AddressId" OnRowDataBound="GridView2_RowDataBound1">
                        <Columns>
                            <asp:BoundField DataField="Street2" HeaderText="Street2" SortExpression="Street2" />
                            <asp:BoundField DataField="Street1" HeaderText="Street1" SortExpression="Street1" />
                            <asp:BoundField DataField="PostalCode" HeaderText="PostalCode" SortExpression="PostalCode" />
                            <asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
                            <asp:TemplateField HeaderText="Region" SortExpression="RegionId">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="RegionLabel" runat="server"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <cc1:EntityDataSource ID="AddressDataSource" runat="server" AssemblyName="Example.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" TypeName="BeerBase.Business.Address" OnSelect="AddressDataSource_Select">
                    </cc1:EntityDataSource>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:HyperLinkField DataNavigateUrlFields="Url" DataTextField="Url" HeaderText="Website" />
        </Fields>
    </asp:DetailsView>
    <cc1:EntityDataSource ID="CompanyDataSource" runat="server" 
        AssemblyName="Example.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
        TypeName="BeerBase.Business.CompanyCollection" OnSelect="CompanyDataSource_Select">
    </cc1:EntityDataSource>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="BeerId" DataSourceID="BeerDataSource" OnRowDataBound="GridView1_RowDataBound" AllowPaging="True" PageSize="5" AllowSorting="True">
        <Columns>
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:TemplateField HeaderText="Style" SortExpression="BeerStyleId">
                <ItemTemplate>
                    <asp:HyperLink ID="StyleLink" runat="server"></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Alcohol" SortExpression="Alcohol">
                <ItemTemplate>
                    &nbsp;<asp:Label ID="AlcoholLabel" runat="server" Text="Label"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Availability" SortExpression="AvailabilityId">
                <ItemTemplate>
                    <asp:HyperLink ID="AvailabilityLink" runat="server">HyperLink</asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <cc1:EntityDataSource ID="BeerDataSource" runat="server" 
        AssemblyName="Example.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
        TypeName="BeerBase.Business.BeerCollection" 
        OnSelect="BeerDataSource_Select">
    </cc1:EntityDataSource>
</asp:Content>